/* 查找第一个满足二进制、八进制、十进制都是回文数的整数 */

#include<iostream>
using namespace std;

int GetBackNum(int num, int base)
{
	int result = 0;
	while (num != 0)
	{
		int mod = num % base;
		num /= base;

		result = result * base + mod;
	}

	return result;
}

int main(void)
{
	for (int i = 11; ; i += 2)
	{
		if (i == GetBackNum(i, 2)
		&& i == GetBackNum(i, 8)
	        && i == GetBackNum(i, 10))
		{
			cout<< i <<endl;
			break;
		}	
	}
	
	return 0;
}
